package com.zyj.test.month1.day1;

import com.zyj.test.ListNode;

/**
 * @author Yijia Zhang
 * @create 2024-04-18 23:51
 */
public class code0206 {
    public ListNode reverseList(ListNode head) {
        ListNode tail = null;
        ListNode p = head;
        while (p != null) {
            ListNode next = p.next;
            p.next = tail;
            tail = p;
            p = next;
        }
        return tail;
    }
}
